    // 自适应echarts的函数
    function fontSize(res) {
        let docEl = document.documentElement,
            clientWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
        if (!clientWidth) return;
        let fontSize = 100 * (clientWidth / 1920);
        return res * fontSize;
    }

    function managementModelChart(echarts, idStr) {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById(idStr));

        // 指定图表的配置项和数据
        var option = {
            legend: {
                show: false,
                top: 'bottom'
            },
            toolbox: {
                show: false,
                feature: {
                    mark: {
                        show: true
                    },
                    dataView: {
                        show: true,
                        readOnly: false
                    },
                    restore: {
                        show: true
                    },
                    saveAsImage: {
                        show: true
                    }
                }
            },
            series: [{
                name: '面积模式',
                type: 'pie',
                radius: ['30%', '50%'],
                avoidLabelOverlap: false,
                itemStyle: {
                    borderRadius: 0
                },
                data: [{
                        value: 40,
                        name: '校外供餐'
                    },
                    {
                        value: 38,
                        name: '食堂自营'
                    },
                    {
                        value: 32,
                        name: '劳务派遣'
                    },
                ]
            }]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    }

    function populardisherChart(echarts, idStr) {

        var myChart = echarts.init(document.getElementById(idStr));

        var option = {
            xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                data: [120, 200, 150, 80, 70, 110, 130],
                type: 'bar'
            }]
        }

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);

    }

    function schoolDistributionChart(echarts, idStr, $) {
        var myChart = echarts.init(document.getElementById(idStr));
        var uploadedDataURL = "/asset/get/s/data-1608104913816-D_E1ZlSEW.json";
        var img = 'image://'
        var img2 = 'image://'
        // var uploadedDataURL = "/asset/get/s/data-1602465184603-MDCI9F57V.json";
        var data = [{
                name: "南宁市",
                value: 402,
            },
            {
                name: "柳州市",
                value: 4617,
            },
            {
                name: "桂林市",
                value: 4215,
            },
            {
                name: "梧州市",
                value: 4803,
            },
            {
                name: "北海市",
                value: 3343,
            },
            {
                name: "防城港市",
                value: 4631,
            },
            {
                name: "钦州市",
                value: 7127,
            },
            {
                name: "贵港市",
                value: 36,
            },
            {
                name: "玉林市",
                value: 136,
            },
            {
                name: "百色市",
                value: 7742,
            },
            {
                name: "贺州市",
                value: 4141,
            },
            {
                name: "河池市",
                value: 5899,
            },
            {
                name: "来宾市",
                value: 3766,
            },
            {
                name: "崇左市",
                value: 4108
            }
        ];
        $.getJSON(uploadedDataURL, function (geoJson) {
            echarts.registerMap('广西', geoJson);

            var gdGeoCoordMap = {
                "南宁市": [108.320004, 22.82402],
                "柳州市": [109.411703, 24.314617],
                "桂林市": [110.299121, 25.274215],
                "梧州市": [111.297604, 23.474803],
                "北海市": [109.119254, 21.473343],
                "防城港市": [108.345478, 21.614631],
                "钦州市": [108.624175, 21.967127],
                "贵港市": [109.602146, 23.0936],
                "玉林市": [110.154393, 22.63136],
                "百色市": [106.616285, 23.897742],
                "贺州市": [111.552056, 24.414141],
                "河池市": [108.062105, 24.695899],
                "来宾市": [109.229772, 23.733766],
                "崇左市": [107.353926, 22.404108]

            };
            var convertData = function (data) {
                var res = [];
                for (var i = 0; i < data.length; i++) {
                    var geoCoord = gdGeoCoordMap[data[i].name];
                    if (geoCoord) {
                        res.push({
                            name: data[i].name,
                            value: geoCoord.concat(data[i].value)
                        });
                    }
                }
                return res;
            };
            option = {
                backgroundColor: '#131C38',
                tooltip: {
                    backgroundColor: 'rgba(0,0,0,0)',
                    trigger: 'axis',
                },
                legend: {
                    show: false,
                },
                geo: [{
                    map: '广西',
                    aspectScale: 0.75,
                    zoom: 1,
                    layoutCenter: ['50%', '50%'],
                    layoutSize: '180%',
                    show: true,
                    roam: false,
                    label: {
                        emphasis: {
                            show: false
                        }
                    },
                    itemStyle: {
                        normal: {
                            borderColor: 'rgba(192,245,249,0)',
                            borderWidth: 3,
                            shadowColor: '#6FFDFF',
                            shadowOffsetY: 0,
                            shadowBlur: 10,
                            areaColor: 'rgba(29,85,139,0)',
                        },

                    },
                    emphasis: {
                        areaColor: 'rgba(29,85,139,0)',
                    }
                }],
                series: [
                    // {
                    //     tooltip: {
                    //         show:false, 
                    //     },
                    //     name: '广西省数据',
                    //     type: 'map',
                    //     map: '广西', // 自定义扩展图表类型 
                    //     zoom: 0.75, //缩放
                    //     showLegendSymbol: false,
                    //     label: {
                    //         normal: {
                    //             show: false,
                    //         },
                    //         emphasis: {
                    //             show: false,
                    //         }
                    //     }, 
                    //     layoutCenter: ['50%', '50%'],
                    //     layoutSize: '100%',
                    //     markPoint: {
                    //         symbol: 'none'
                    //     },
                    //     data: data,
                    // }, 
                    {
                        tooltip: {
                            show: false,
                        },
                        type: 'effectScatter',
                        coordinateSystem: 'geo',
                        rippleEffect: {
                            scale: 10,
                            brushType: 'stroke',
                        },
                        showEffectOn: 'render',
                        itemStyle: {
                            normal: {
                                color: '#00FFFF',
                            }
                        },
                        label: {
                            normal: {
                                color: '#fff',
                            },
                        },
                        symbol: 'circle',
                        symbolSize: [10, 5],
                        data: convertData(data),
                        zlevel: 1,
                    },
                    {
                        type: 'scatter',
                        coordinateSystem: 'geo',
                        itemStyle: {
                            color: '#00FFF6',
                        },
                        symbol: img,
                        symbolSize: [32, 41],

                        symbolOffset: [0, -20],
                        z: 999,
                        data: convertData(data),
                    },
                    {
                        type: 'scatter',
                        coordinateSystem: 'geo',
                        label: {
                            normal: {
                                show: true,
                                formatter: function (params) {
                                    var name = params.name
                                    var value = params.value[2]
                                    var text = `{fline|${value}人}\n{tline|${name}}`
                                    return text;
                                },
                                color: '#fff',
                                rich: {
                                    fline: {
                                        padding: [0, 25],
                                        color: '#fff',
                                        fontSize: 14,
                                        fontWeight: 400
                                    },
                                    tline: {
                                        padding: [0, 27],
                                        color: '#ABF8FF',
                                        fontSize: 12,
                                    },
                                }
                            },
                            emphasis: {
                                show: true
                            }
                        },
                        itemStyle: {
                            color: '#00FFF6',

                        },
                        symbol: img2,
                        symbolSize: [100, 50],
                        symbolOffset: [0, -60],
                        z: 999,
                        data: convertData(data),
                    }
                ],
            }
            myChart.setOption(option);
        })
    }